home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17094 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. Path: news.nyu.edu!schonberg!dewar
  2. From: dewar@cs.nyu.edu (Robert Dewar)
  3. Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++,comp.edu
  4. Subject: Re: ANSI C and POSIX (was Re: C/C++ knocks the crap out of Ada)
  5. Date: 13 Apr 1996 08:55:24 -0400
  6. Organization: Courant Institute of Mathematical Sciences
  7. Message-ID: <dewar.829399701@schonberg>
  8. References: <JSA.96Feb16135027@organon.com> <dewar.828846122@schonberg> <4kkdv4$ik4@nntp.Stanford.EDU> <dewar.829345962@schonberg> <4knqun$ga1@nntp.Stanford.EDU>
  9. NNTP-Posting-Host: schonberg.cs.nyu.edu
  10. X-Newsreader: NN version 6.5.0 (NOV)
  11.  
  12. Chuck asked (replying to me):
  13.  
  14. ">Of course GCC has a much more agressive view of portability, but it
  15. >certainly would be nice to see more standardization here,
  16.  
  17. I don't understand.  Do you have portability problems when you use
  18. gcc in ANSI mode?"
  19.  
  20. Yes we do. gcc takes the view that it should work in all common C
  21. environments (i.e. those in use today), whether or not they are ANSI
  22. compliant. Early on when I started writing some C runtime code for
  23. GNAT (or more accurately interfacing to standard C runtime routines),
  24. I followed the ANSI standard. As I mentioned before the particular
  25. example I remember is that I used the return value of sprintf,
  26. assuming it returned int. My code worked on several systems, and
  27. then failed on SunOS, and I was told -- oh yes, everyone knows that
  28. you cannot use the returned value of sprintf. Now of course it is
  29. the case that there must be available on SunOS a conforming library,
  30. but we require gcc to work with all commonly used environments without
  31. any special fiddling in choosing libraries. That's what I meant by
  32. saying that gcc has a more strenuous view of portability. Chuck's
  33. view of portablity seems to be "use ANSI, and too bad if it doesn't
  34. work for you". That's fair enough but it is not the attitude that
  35. gcc takes, where we are aiming for much more general portability.
  36.  
  37. Over time, the two views will converge but not yet. I have found the
  38. Microsoft runtime reference manual very useful. For each function it
  39. indicates ANSI/Unix/Xenix/DOS/OS2 compatibility. There are many cases
  40. where the ANSI box is checked and other boxes are not. For instance,
  41. unlink is compatible with all systems but is NOT ANSI, on the other
  42. hand delete, which is the ANSI version, is not available on all systems.
  43.  
  44. It just depends on what you are trying to achieve!
  45.  
  46.